﻿Imports System

Module Main

    Sub Main()

        Dim Args_String As String = Command()
        Dim Parameters(), Parameter_Values() As String


        If Args_String Is "" Then
            Dim Good_events_analysis_Form As Form1
            Good_events_analysis_Form = New Form1
            Good_events_analysis_Form.ShowDialog()
            Good_events_analysis_Form.Get_Parameters(Args_String)
            Good_events_analysis_Form.Close()
        End If

        If Split_Parameters(Args_String, Parameters, Parameter_Values) Then
            Exit Sub
        End If

        Dim Input_File() As String
        Dim Lower_Lewel As Integer
        Dim Upper_Lewel As Integer
        Dim Min_Intensity As Integer
        Dim Lower_Lewel1 As Integer
        Dim Upper_Lewel1 As Integer
        Dim Initial_Frame As Integer
        Dim Final_Frame As Integer

        Dim Nonrecognized_Parameters As String = ""
        For i As Integer = 0 To Parameters.Length - 1
            Select Case Parameters(i)
                Case "Input_File"
                    Input_File = Parameter_Values(i).Split(vbNewLine)
                Case "Lower_Lewel"
                    Lower_Lewel = Parameter_Values(i)
                Case "Upper_Lewel"
                    Upper_Lewel = Parameter_Values(i)
                Case "Min_Intensity"
                    Min_Intensity = Parameter_Values(i)
                Case "Lower_Lewel1"
                    Lower_Lewel1 = Parameter_Values(i)
                Case "Upper_Lewel1"
                    Upper_Lewel1 = Parameter_Values(i)
                Case "Initial_Frame"
                    Initial_Frame = Parameter_Values(i)
                Case "Final_Frame"
                    Final_Frame = Parameter_Values(i)
                    'Case "NO_Of_Frame_To_Analize"
                    'Case "Histograme_File"
                    'Case "Hits_File"
                Case Else
                    Nonrecognized_Parameters = Nonrecognized_Parameters
            End Select
        Next

        Read_File(Input_File(0), Initial_Frame, Final_Frame, 1340, 400, 2, Lower_Lewel, Upper_Lewel, Min_Intensity, Lower_Lewel1, Upper_Lewel1)

    End Sub

End Module
